package com.yykj.hospital.server.model.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yykj.common.util.serializer.LocalDate2LongSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.time.LocalDateTime;

@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HospitalSettingCheck {
    @Id
    @ApiModelProperty("医院ID")
    private Integer hospitalId;

    @ApiModelProperty("申请单有效期：单位天")
    private Integer cnt1 ;

    @JsonSerialize(using = LocalDate2LongSerializer.class)
    @CreationTimestamp
    private LocalDateTime addTime;

    @JsonSerialize(using = LocalDate2LongSerializer.class)
    @UpdateTimestamp
    private LocalDateTime modifyTime;

    public static HospitalSettingCheck defaultHospitalSettingCheck(Integer hospitalId){
        return HospitalSettingCheck.builder()
                .hospitalId(hospitalId)
                .cnt1(1)
                .build();
    }

}
